namespace ai_library
{
	public class ConditionFactoryException : System.Exception
	{
		protected string message;
		public ConditionFactoryException(string message) { this.message = message; }
		public override string Message { get { return message; } }
		public override string ToString() { return "Condition Factory Exception: " + message; }
	}

	public static class ConditionFactory<T> where T : IEntity, IEntityStateMachine<T>
	{
		public static ICondition<T> Get(ConditionTypes conditionType)
		{
			ICondition<T> retCond = null;
			
			switch (conditionType)
			{
			case ConditionTypes.RandomRange_0_10:
				retCond = new RandomRangeCondition<T>(0,10);
				break;
				
			case ConditionTypes.RandomRange_0_5:
				retCond = new RandomRangeCondition<T>(0,5);
				break;
			}

			if (retCond == null)
				throw new ConditionFactoryException("ConditionType " + conditionType + " not defined in factory");
			
			return retCond;
		}
	}
}

